﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IM.Easy.AuthorizationServices.Dtos
{
    /// <summary>
    /// 登录用户信息
    /// </summary>
    public class LoginUser
    {
        /// <summary>
        /// id
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 昵称
        /// </summary>
        public string NickName { get; set; }

        /// <summary>
        /// 真实姓名
        /// </summary>
        public string RealName { get; set; }

        /// <summary>
        /// 手机号码
        /// </summary>
        public string Mobile { get; set; }

        /// <summary>
        /// 电子邮件
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        public int Gender { get; set; }

        /// <summary>
        /// 出生日期
        /// </summary>
        public DateTime? BirthDay { get; set; }

        /// <summary>
        /// 用户头像
        /// </summary>
        public string Avatar { get; set; }

        /// <summary>
        /// 登录客户端id
        /// </summary>
        public string ClientId { get; set; }

        /// <summary>
        /// 判断当前用户是否为超级管理员
        /// </summary>
        /// <returns></returns>

        public bool IsSuperAdmin { get { return Id == 1; } }


        /// <summary>
        /// 拥有的角色
        /// </summary>
        public List<LoginUserRole> Roles { get; set; }

        /// <summary>
        /// 拥有的权限
        /// </summary>
        public List<string> Perms { get; set; }

        /// <summary>
        /// 账户提供商  默认为本系统  
        /// </summary>
        public string Provider { get; set; }

    }

    public class LoginUserRole
    {
        public long Id { get; set; }
        /// <summary>
        /// 角色名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 角色编码
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 拥有的权限字符串
        /// </summary>
        public string Perms { get; set; }
    }
}
